package com.example.mobile2021606145zbq0407homework;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity7 extends AppCompatActivity {

    private TextView tvMainTitle6;
    private TextView tvMain62;
    private TextView tvMain63;
    private TextView tvFenshu;
    private EditText edtSixOne;
    private Button btn6;
    private TextView TVResult6;
    int num = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main7);
        initView();
        btn6.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String string = edtSixOne.getText().toString();
                int num=Integer.valueOf(string).intValue();
                if (num >= 90){
                    TVResult6.setText("A");
                } if (80 <= num&num <= 89){
                    TVResult6.setText("B");
                } if (70 <= num&num <= 79){
                    TVResult6.setText("C");
                } if (60 <= num&num <= 69){
                    TVResult6.setText("D");
                }if (num<60){
                    TVResult6.setText("E");
                }
            }
        });
    }

    private void initView() {
        tvMainTitle6 = (TextView) findViewById(R.id.tv_main_title6);
        tvMain62 = (TextView) findViewById(R.id.tv_main_6_2);
        tvMain63 = (TextView) findViewById(R.id.tv_main_6_3);
        tvFenshu = (TextView) findViewById(R.id.tv_fenshu);
        edtSixOne = (EditText) findViewById(R.id.edt_six_one);
        btn6 = (Button) findViewById(R.id.btn_6);
        TVResult6 = (TextView) findViewById(R.id.TV_result_6);
    }
}